package com.chhuang.core.enums;

/**
 * @ClassName SaCode
 * @Description 请求返回代码
 * @Author Darren Huang
 * @Date 2022/11/19 0:07
 * @Version 1.0
 */
public enum SaCode {
    /**
     * 请求成功
     */
    SUCCESS(200, "操作成功"),
    PARAMS_VALID_FAIL(400, "参数校验失败"),
    NOT_LOGIN(401, "用户未登录"),
    UN_AUTH(402, "请求未授权"),
    REQ_REJECT(403, "请求被拒绝"),
    NOT_FOUND(404, "请求地址不正确或接口不存在"),
    METHOD_NOT_SUPPORTED(405, "不支持当前请求方法"),
    MEDIA_TYPE_NOT_SUPPORTED(415, "不支持当前媒体类型"),
    INTERNAL_SERVER_ERROR(500, "服务器异常"),

    LOGIN_CAPTCHA_FAIL(1000, "验证码有误"),
    LOGIN_USERNAME_PASSWORD_FAIL(1001, "用户名或密码有误"),

    REGEDIT_USERNAME_ALREADY_EXISTS(1010, "用户名已存在"),
    REGEDIT_PHONE_ALREADY_EXISTS(1011, "手机号已存在"),
    REGEDIT_EMAIL_ALREADY_EXISTS(1012, "邮箱号已存在"),

    CAPTCHA_CODE_ALREADY_SEND(1020, "验证码已发送"),

    NOT_AUTH(1100, "没有访问权限"),
    SEACH_FAIL(2000, "没有找到"),
    SAVE_FAIL(2001, "添加失败"),
    MODIFY_FAIL(2002, "修改失败"),
    REMOVE_FAIL(2003, "删除失败");

    /**
     * code编码
     */
    Integer code;
    /**
     * 中文信息描述
     */
    String message;

    SaCode(Integer code, String message){
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getCodeStr(){return code.toString();}

    public String getMessage() {
        return message;
    }
}
